<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>综合练习</title>
</head>
<body>
    <input type="text" placeholder="请输入添加的图片数量">
    <input type="button" value="帅哥" onclick="f1()">
    <input type="button" value="美女" onclick="f2()">
    <script>
        let i = document.querySelector("input")
        function f1(){
            for(let j = 0;j<i.value;j++){
                // 创建图片标签
                let img = document.createElement("img")
                // 添加图片路径
                img.src="https://img2.baidu.com/it/u=1103740651,3828883478&fm=253&fmt=auto&app=120&f=JPEG?w=200&h=75"
                // 将图片添加到页面
                document.body.append(img)
            }
        }
        function f2(){
            for(let j = 0;j<i.value;j++){
                // 创建图片标签
                let img = document.createElement("img")
                // 添加图片路径
                img.src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2Fec80fbd1-337f-4962-ac45-f79faa36f60c%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1697182056&t=b331acf18134d067de9af971daac736d"
                // 将图片添加到页面
                document.body.append(img)
            }
        }
    </script>
</body>
</html>